from datetime import datetime, timedelta

timetable = [13, 1, 2, 3, 5, 4, 4, 2, 2, 2]
cur = datetime(year=2000, day=1, month=1)
end = datetime(year=2024, day=13, month=4)
result = 0
while cur <= end:
    s = cur.strftime("%Y%m%d")
    sums = 0
    for c in s:
        sums += timetable[int(c)]
    if sums > 50:
        result += 1
    cur += timedelta(days=1)

print(result)
